package me.yxy.mobanddd.controller;

import me.yxy.mobanddd.domain.user.User;
import me.yxy.mobanddd.domain.user.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Optional;

@RestController
@RequestMapping("/user")
@ResponseBody
@SuppressWarnings("unused")
public class UserEntrance {

    /**
     * @return
     */
    @PostMapping("/modify")
    @Transactional
    public String createShipmentWithTransportOrders(){

        Optional<User> user = userRepository.findById(1l);
        user.get().modify("test",System.currentTimeMillis()+"");

        return "1";
    }

    @Autowired
    UserRepository userRepository;
}
